package be.bonamis.timesheet.model;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import org.apache.commons.lang.builder.ToStringBuilder;

@Entity
@Table(name = "projects")
public class Project extends PersistentObject{	


	private static final long serialVersionUID = 1L;

	@Column(name = "project_name", nullable = false)
	private String name;	

	/**
	 * Gets a builder which is used to create Person objects.
	 * 
	 * @param firstName
	 *            The first name of the created user.
	 * @param lastName
	 *            The last name of the created user.
	 * @return A new Builder instance.
	 */
	public static Builder getBuilder(String name) {
		return new Builder(name);
	}



	public String getName() {
		return name;
	}


	public void update(String name) {
		this.name = name;
	}



	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this);
	}

	/**
	 * A Builder class used to create new Person objects.
	 */
	public static class Builder {
		Project built;

		/**
		 * Creates a new Builder instance.
		 * 
		 * @param firstName
		 *            The first name of the created Person object.
		 * @param lastName
		 *            The last name of the created Person object.
		 */
		Builder(String name) {
			built = new Project();
			built.name = name;
		}

		/**
		 * Builds the new Person object.
		 * 
		 * @return The created Person object.
		 */
		public Project build() {
			return built;
		}
	}



}
